﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VINETLIFE.BL;
using VINETLIFE.DO;
using System.Data;
using VINETLIFE.AdminCP;
using System.Web.UI.HtmlControls;

namespace VINETLIFE.Customers
{
    public partial class Customer : System.Web.UI.Page
    {
        cmsCustomerDO objCus = new cmsCustomerDO();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["CustomerId"] != null)
            {
                objCus.Id = int.Parse(Session["CustomerId"].ToString());
                if (!IsPostBack)
                {
                    SEO();
                    InitForm();
                }
            }
            else
            {
                Functions.Alert("Bạn không có quyền truy cập vào khi chưa đăng nhập, vui lòng đăng nhập", "/dang-nhap/");
            }
        }
       
        private void SEO()
        {
            Page.Title = "Thông tin cá nhân | " + Ultility.WebTitle();

            sysConfigDO objConfig = new sysConfigDO();
            objConfig.ConfigID = 2;

            objConfig = new sysConfigBL().Select(objConfig);


            HtmlMeta metaKey = new HtmlMeta();
            metaKey.Name = "keywords";
            metaKey.Content = objConfig.ConfigValue;
            Page.Header.Controls.Add(metaKey);


            objConfig.ConfigID = 3;
            objConfig = new sysConfigBL().Select(objConfig);
            HtmlMeta metaDesc = new HtmlMeta();
            metaDesc.Name = "description";
            metaDesc.Content = objConfig.ConfigValue;
            Page.Header.Controls.Add(metaDesc);
        }
        private void InitForm()
        {
            objCus = new cmsCustomerBL().Select(objCus);
            lblUserName1.Text = objCus.UserName;
            lblHoTen.Text = objCus.FullName;
            lblDiaChi.Text = objCus.Address;
            lblSex.Text = objCus.Sex ? "Nam" : "Nữ";
            lblEmail.Text = objCus.Email;
            lblPhone.Text = objCus.Phone;
            lblCMTND.Text = objCus.Identification;
            lblMaSoCaNhan.Text = objCus.CustomerCode;
        }


        protected void btnHuy_Click(object sender, EventArgs e)
        {
            InitForm();
        }


    }
}
